package com.lzy.cloud.order.service.impl;

import com.lzy.cloud.order.dtos.OrderRefundVerifyDto;
import com.lzy.cloud.order.entity.OrderRefundVerify;
import com.lzy.cloud.order.mapper.OrderRefundVerifyMapperExt;
import com.lzy.cloud.order.service.OrderRefundVerifyService;
import com.lzy.framework.core.utils.DozerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 订单交易记录
 * @Author:   gyl
 * @Date:     2018/7/10 19:05
 */
@Service
public class OrderRefundVerifyServiceImpl implements OrderRefundVerifyService {

    @Autowired
    private OrderRefundVerifyMapperExt orderRefundVerifyMapperExt;

    @Override
    public List<OrderRefundVerifyDto> queryList(OrderRefundVerifyDto orderRefundVerifyDto) {
        return orderRefundVerifyMapperExt.queryList(orderRefundVerifyDto);
    }

    @Override
    public Long create(OrderRefundVerifyDto orderRefundVerifyDto) {
        OrderRefundVerify orderRefundVerify = DozerUtils.map(orderRefundVerifyDto, OrderRefundVerify.class);
        return orderRefundVerifyMapperExt.insertSelective(orderRefundVerify)>0 ? orderRefundVerify.getId() : 0;
    }

    @Override
    public void deleteByRefundId(Long refundId) {
        orderRefundVerifyMapperExt.deleteByRefundId(refundId);
    }

    @Override
    public Boolean update(OrderRefundVerifyDto orderRefundVerifyDto) {
        return orderRefundVerifyMapperExt.updateByPrimaryKeySelective(DozerUtils.map(orderRefundVerifyDto, OrderRefundVerify.class)) > 0;
    }
}
